﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace TongJi
{

        [DataContract]
        public class TPLList
        {
            [DataMember(Order = 0)]
            public string mshowname { get; set; }
            [DataMember(Order = 1)]
            public string icon { get; set; }
            [DataMember(Order = 2)]
            public string mid { get; set; }


            [DataMember(Order = 3)]
            public List<Games> games { get; set; }


            public List<TPLList> GetDBS(string str)
            {
                try
                {
                    Action<object> log = o => Console.WriteLine(o);
                    Func<int, int, int> add = (x, y) => x + y;
                    var elementdb = JsonConvert.DeserializeObject<List<TPLList>>(str);

                    //log(JArray.Parse(str)); //注意，格式化过的输出

                    return elementdb;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return null;
                }
            }
        }
        [DataContract]
        public class Games
        {
            [DataMember(Order = 0)]
            public string tag { get; set; }
            [DataMember(Order = 1)]
            public string icon { get; set; }
            [DataMember(Order = 2)]
            public string gid { get; set; }

            [DataMember(Order = 3)]
            public string sid { get; set; }

            [DataMember(Order = 4)]
            public string showname { get; set; }


        }
}
